# -*- coding: utf8 -*-

a_str = """
abc
bcd
def
"""

a_list = a_str.split()

print(a_list)
print(type(a_list))

with open('nginx.conf', 'w') as f:
    f.write("location /xxx/ {\n")
    for l in a_list:
        f.write("\t%s;\n" % l.strip())
    f.write("\t%s;\n" % "proxy_pass http://ingress")
    f.write("}")